<?php
	echo $this->renderElement('message');
	echo "<h2 id='contentTitle'>".$pageTitle."</h2>";
	
	//Tratando o URL trocando o valor watch?v= por v/ 
	$aux = explode('watch?v=', $video['Video']['url']);
        $aux=htmlspecialchars(urldecode($aux[0])).'v/'.htmlspecialchars(urldecode($aux[1]));
	
	echo "<div id='view'>";
		echo "<p><label>Nome: </label><span>".$video['Video']['name']."</span></p>";
		
		//OBJETO EMBED do Youtube
		echo "<object width='425' height='344'>";
			echo "<param name='movie' value='".$aux."'></param>";
			echo "<param name='allowFullScreen' value='true'>";
			echo "</param><param name='allowscriptaccess' value='always'></param>";
			echo "<embed src='".$aux."' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='344'></embed>";
		echo "</object>";
		
		echo "<p><label>URL do YouTube: </label><span>".$video['Video']['url']."</span></p>";
		echo "<p><label>Descrição: </label><span>".$video['Video']['description']."</span></p>";
		
		
		/* Botoes - Inicio */
		$entity = 'videos';
		$model = 'Video';
		$label = 'Video';
		$label_plural = 'Videos';
		echo "<br />";
		echo "<div class='buttonBox'>";
		echo "<div class='buttonMinibox'>";
		$listButton = "<span class=\"buttonList\">Listar ".$label_plural."</span>";
		echo html_entity_decode($html->link($listButton, '/'.$entity.'/index/',array('class'=>'button')));
		echo "</div>";
		echo "<div class='buttonMinibox'>";
		if ($othAuth->hasPermission($entity.'/edit/')) {
			$editButton = "<span class=\"buttonEdit\">Editar ".$label."</span>";
			echo html_entity_decode($html->link($editButton, '/'.$entity.'/edit/'.$video[$model]['id'],array('class'=>'button')));
		}
		echo "</div>";
		echo "<div class='buttonMinibox'>";
		if ($othAuth->hasPermission($entity.'/delete/')) {
			$deleteButton = "<span class=\"buttonDelete\">Apagar ".$label."</span>";
			echo html_entity_decode($html->link($deleteButton,'/'.$entity.'/delete/'.$video[$model]['id'], array('class'=>'button'), 'Confirma a exclusão desse Video?'));
		}
		echo "</div>";
		echo "</div>";
		/* Botoes - Fim */
	echo "</div>";
?>
